package cafe.jpa;

import java.io.Serializable;
import java.sql.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="WAITERS")
public class Waiter implements Serializable {
	
	public static final transient int ID_UPDATE = 1;
	public static final transient int FIRSTNAME_UPDATE = 2;
	public static final transient int LASTNAME_UPDATE = 3;
	public static final transient int PATRONYMICNAME_UPDATE = 4;
	public static final transient int BORN_DAY_UPDATE = 5;
	public static final transient int BORN_MONTH_UPDATE = 6;
	public static final transient int BORN_YEAR_UPDATE = 7;
	public static final transient int HIRE_DAY_UPDATE = 8;
	public static final transient int HIRE_MONTH_UPDATE = 9;
	public static final transient int HIRE_YEAR_UPDATE = 10;
	public static final transient int SALARY_UPDATE = 11;
	
	public Waiter() {}
	
	@Id
	@Column(name="ID_WAITER")
	@GeneratedValue(generator="WAITER_ID_SEQUENCE")
	@SequenceGenerator(name="WAITER_ID_SEQUENCE",sequenceName="WAITER_ID_SEQUENCE", allocationSize=1)
	private long id;
	 
	@Column(name="FIRST_NAME")
	private String firstName;
	 
	@Column(name="LAST_NAME")
	private String lastName;
	 
	@Column(name="PATRONYMIC_NAME")
	private String patronymicName;
	 
	@Column(name="BORN_DATE")
	private Date bornDate;
	 
	@Column(name="HIRE_DATE")
	private Date hireDate;	
	
	@Column(name="SALARY")
	private int salary;	
	 
	@ManyToMany(mappedBy="waiters")
	private Set<Order> orders;
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getPatronymicName() {
		return patronymicName;
	}

	public void setPatronymicName(String patronymicName) {
		this.patronymicName = patronymicName;
	}

	public Date getBornDate() {
		return bornDate;
	}

	public void setBornDate(Date bornDate) {
		this.bornDate = bornDate;
	}

	public Date getHireDate() {
		return hireDate;
	}
	
	public String getHireDateString() {
		return hireDate.toString();
	}
	
	public String getBornDateString() {
		return bornDate.toString();
	}

	public void setHireDate(Date hireDate) {
		this.hireDate = hireDate;
	}

	public int getSalary() {
		return salary;
	}

	public void setSalary(int salary) {
		this.salary = salary;
	}

	public Set<Order> getOrders() {
		return orders;
	}

	public void setOrders(Set<Order> orders) {
		this.orders = orders;
	}	 
}
